/**
 * This class is the key holder for the charactersheet.
 * Its also a superclass for all character data.
 * 
 * 
 * @since 21.06.2010
 * @author vegard.aasen
 */

package character;

import java.net.URL;
import java.util.EnumMap;

import wowarmory.WowRealms;

public class WowCharacter {
	
	/*
	 * CharacterInformation
	 */
	private String charName;
	private Integer charLevel;
	private Enum<ClassType> classType;
	private Enum<?> charRace;
	private Integer raceId;
	private String charTitle;
	private Enum<Gender> charGender;
	private Enum<Faction> charFaction;
	private URL characterUrl;
	private Integer achievementPoints;
	
	private EnumMap<Gender, Enum<?>> genderAndCharacterRace;
		
	/*
	 * General info about character
	 */
	
	private WowRealms realm;
	private String lastModified; //TODO: Should be date
	private String battleGroup;
	
	/*
	 * GUILD INFO
	 */
	
	private String guildName;
	private String guildUri;
	
	
	/**
	 * 01 = Human
	 * 02 = Orc
	 * 03 = Dwarf
	 * 04 = Night Elf
	 * 05 = Undead
	 * 06 = Tauren
	 * 07 = Gnome
	 * 08 = Troll
	 * 10 = Bloodelf
	 * 11 = Draenei
	 * 
	 * @param raceId
	 * @return alliance/horde
	 */
	public Enum<?> getCurrentRaceType(Integer raceId) {
		Enum<?> raceType = null;
		switch (raceId) {
			case 1: 
				raceType = Alliance.Human;
				break;
			case 2:
				raceType = Horde.Orc;
				break;
			case 3:
				raceType = Alliance.Dwarf;
				break;
			case 4:
				raceType = Alliance.NightElf;
				break;
			case 5:
				raceType = Horde.Undead;
				break;
			case 6:
				raceType = Horde.Tauren;
				break;
			case 7:
				raceType = Alliance.Gnome;
				break;
			case 8:
				raceType = Horde.Troll;
				break;
			case 10:
				raceType = Horde.BloodElf;
				break;
			case 11:
				raceType = Alliance.Draenei;
				break;
		}
		return raceType;
	}
	
	
	/**
 	 * 1 = Warrior, 
 	 * 2 = Paladin, 
 	 * 3 = Hunter, 
 	 * 4 = Rogue, 
 	 * 5 = Priest, 
 	 * 7 = Shaman, 
 	 * 8 = Mage, 
 	 * 9 = Warlock, 
 	 * 11 = Druid
	 * 
	 * @param classId
	 * @return classTypeDef
	 */
	public Enum<?> getCurrentClassType(Integer classId) {
		Enum<?> classType = null;
		switch (classId) {
			case 1: 
				classType = ClassType.Warrior;
				break;
			case 2:
				classType = ClassType.Paladin;
				break;
			case 3:
				classType = ClassType.Hunter;
				break;
			case 4:
				classType = ClassType.Rogue;
				break;
			case 5:
				classType = ClassType.Priest;
				break;
			case 7:
				classType = ClassType.Shaman;
				break;
			case 8:
				classType = ClassType.Mage;
				break;
			case 9:
				classType = ClassType.Warlock;
				break;
			case 11:
				classType = ClassType.Druid;
				break;
		}
		return classType;
	}
	
	public Enum<?> getCurrentCharacterType(ClassType classType, WowCharacterTalents stats) {
		ClassOperationType classOpType = null;
		classOpType = currentCharacterIsType(classType);
		if(classOpType.equals(ClassOperationType.UNDEFINED) && 
				classType.equals(ClassType.DeathKnight)
				|| classType.equals(ClassType.Druid)
				|| classType.equals(ClassType.Warrior)
				|| classType.equals(ClassType.Shaman)
				|| classType.equals(ClassType.Paladin)) {
			classOpType = stats.currentCharacterIsType(classType);
		}
		return classOpType;
	}
	
	public ClassOperationType currentCharacterIsType(ClassType classType) {
		ClassOperationType classOpType = null;
		if(classType.equals(ClassType.Rogue)) classOpType = ClassOperationType.MELEE;
		if(classType.equals(ClassType.DeathKnight)) classOpType = ClassOperationType.UNDEFINED;
		if(classType.equals(ClassType.Druid)) classOpType = ClassOperationType.UNDEFINED;
		if(classType.equals(ClassType.Hunter)) classOpType = ClassOperationType.RANGED;
		if(classType.equals(ClassType.Mage)) classOpType = ClassOperationType.RANGED;
		if(classType.equals(ClassType.Paladin)) classOpType = ClassOperationType.UNDEFINED;
		if(classType.equals(ClassType.Priest)) classOpType = ClassOperationType.RANGED;
		if(classType.equals(ClassType.Shaman)) classOpType = ClassOperationType.UNDEFINED;
		if(classType.equals(ClassType.Warlock)) classOpType = ClassOperationType.RANGED;
		if(classType.equals(ClassType.Warrior)) classOpType = ClassOperationType.UNDEFINED;
		return classOpType;
	}
	
	public String getCharName() {
		return charName;
	}
	public void setCharName(String charName) {
		this.charName = charName;
	}
	public Integer getCharLevel() {
		return charLevel;
	}
	public void setCharLevel(Integer charLevel) {
		this.charLevel = charLevel;
	}
	
	public ClassType getClassTypeTest() {
		return (ClassType) classType;
	}
	public Enum<ClassType> getClassType() {
		return classType;
	}
	public void setClassType(Enum<ClassType> classType) {
		this.classType = classType;
	}
	public Enum<?> getCharRace() {
		return charRace;
	}
	public void setCharRace(Enum<?> charRace) {
		this.charRace = charRace;
	}
	public Integer getRaceId() {
		return raceId;
	}
	public void setRaceId(Integer raceId) {
		this.raceId = raceId;
	}
	public String getCharTitle() {
		return charTitle;
	}
	public void setCharTitle(String charTitle) {
		this.charTitle = charTitle;
	}
	public Enum<Gender> getCharGender() {
		return charGender;
	}
	public void setCharGender(Enum<Gender> charGender) {
		this.charGender = charGender;
	}
	public Enum<Faction> getCharFaction() {
		return charFaction;
	}
	public void setCharFaction(Enum<Faction> charFaction) {
		this.charFaction = charFaction;
	}
	public WowRealms getRealm() {
		return realm;
	}
	public void setRealm(WowRealms realm) {
		this.realm = realm;
	}
	public String getLastModified() {
		return lastModified;
	}
	public void setLastModified(String lastModified) {
		this.lastModified = lastModified;
	}
	public String getBattleGroup() {
		return battleGroup;
	}
	public void setBattleGroup(String battleGroup) {
		this.battleGroup = battleGroup;
	}
	public String getGuildName() {
		return guildName;
	}
	public void setGuildName(String guildName) {
		this.guildName = guildName;
	}
	public String getGuildUri() {
		return guildUri;
	}
	public void setGuildUri(String guildUri) {
		this.guildUri = guildUri;
	}

	public EnumMap<Gender, Enum<?>> getGenderAndCharacterRace() {
		return genderAndCharacterRace;
	}

	public void setGenderAndCharacterRace(EnumMap<Gender, Enum<?>> genderAndCharacterRace) {
		this.genderAndCharacterRace = genderAndCharacterRace;
	}

	public URL getCharacterUrl() {
		return characterUrl;
	}

	public void setCharacterUrl(URL characterUrl) {
		this.characterUrl = characterUrl;
	}

	public Integer getAchievementPoints() {
		return achievementPoints;
	}

	public void setAchievementPoints(Integer achievementPoints) {
		this.achievementPoints = achievementPoints;
	}
}
